<?php
//PingBuWang.Com
//Copyright (c) 2017~2099 http://www.pingbuwang.com All rights reserved.
namespace app\setting\controller;
use think\Cache;
use think\Request;
use mip\AdminApiBase;
class ApiAdminSetting extends AdminApiBase
{
    public function get_map(){

        $settings = array();
        $dbSettings = model('app\setting\model\Setting')->getList();

        if($dbSettings){
            foreach ($dbSettings as $k1=>$v1){
                $settings[$v1['key']] = $v1['val'];
            }
        }

        return jsonSuccess('查询成功，并转换为key-value格式', $settings );
    }

    public function get_list(){
        $settings = model('app\setting\model\Setting')->getList();
        return jsonSuccess('查询成功',$settings);
    }
    

    public function do_edit(){

        $settingInfo = json_decode(input('post.setting'));
        model('app\setting\model\Setting')->doEdit($settingInfo);
        return jsonSuccess('保存成功');
    }



}